<meta charset="UTF-8">
<?php
require ('./lib/init.php');
// 判断用户是否登录
if (!acc()) {
    header('Location:login.php');
}
// 获取传递过来的userid值
$userId = trim($_GET['user']);
if (empty($userId)) error('参数错误！','javascript:history.back(-1)');
// 判断userid是否存在数据库中
$sql = "select count(*) from user where id = '$userId'";
if(mGetOne($sql) == 0) error('用户id错误！','javascript:history.back(-1)');
// 检测完毕 删除用户
$sql = "delete from user where id = '$userId'";
if(!mQuery($sql)){
    error('删除失败！','javascript:history.back(-1)');
}else{
    header('location:role.php');
}
?>
